// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 添加新闻 */
export async function createAboutUs(options) {
  return request<{
    data;
  }>('/api/mjAboutUs/add', {
    method: 'POST',
    data:(options || {}),
  });
}

/** 删除新闻 */
export async function deleteAboutUs(options) {
    return request<{
      data;
    }>('/api/mjAboutUs/delete', {
      method: 'GET',
      ...(options || {}),
    });
  }
  
  /** 新闻列表 */
export async function fetchAboutUsList(options) {
   const result = await request('/api/mjAboutUs/queryByPage', {
      method: 'POST',
      data: options,
    });
    return { data: result.data.records, success: true,total:result.data.total }
  }
  
  
export async function updateAboutUs(options) {
    console.log(options)
    return request<{
      data;
    }>('/api/mjAboutUs/edit', {
      method: 'POST',
      data:(options || {}),
    });
  }








/** 获取规则列表 GET /api/rule */
export async function rule(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.RuleList>('/api/rule', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 更新规则 PUT /api/rule */
export async function updateRule(options?: { [key: string]: any }) {
  return request<API.RuleListItem>('/api/rule', {
    method: 'POST',
    data: {
      method: 'update',
      ...(options || {}),
    },
  });
}

/** 新建规则 POST /api/rule */
export async function addRule(options?: { [key: string]: any }) {
  return request<API.RuleListItem>('/api/rule', {
    method: 'POST',
    data: {
      method: 'post',
      ...(options || {}),
    },
  });
}

/** 删除规则 DELETE /api/rule */
export async function removeRule(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/rule', {
    method: 'POST',
    data: {
      method: 'delete',
      ...(options || {}),
    },
  });
}
